<?php
        include '../class/database.php';

            
        $id = 0;

        if ( !empty($_GET['id'])) {
            $id = $_REQUEST['id'];
        }
        if ( !empty($_POST)) {
       
        $foo = implode( ',', $_POST['foo'] );
        
	$pdo = Database::connect();
        $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $sql = "DELETE FROM posts WHERE id IN ({$foo}) ";
        $q = $pdo->prepare($sql);
        $q->execute(array($id));
        Database::disconnect();
        header("Location: ../posts");
        }
?>
